package com.java.zhuiyun.api.rolerank.controller;

import com.java.zhuiyun.api.rolerank.entity.RoleRank;
import com.java.zhuiyun.api.rolerank.service.RolerankService;
import com.java.zhuiyun.common.response.CommonResult;
import com.java.zhuiyun.util.pageUtil.PageRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @ClassName RolerankController
 * @Description TODO
 * @Author wuwan
 * @Date 2023/9/13 19:41
 **/
@RestController
@RequestMapping("/Rolerank")
public class RolerankController {
    @Autowired
    private RolerankService rolerankService;
    /*
    * @Author wuwan
    * @Description 角色等级查询
    * @Date 2023/9/13 20:07
    * @Return 
    * @param null
    */
    @GetMapping("/selectRolerank")
    public CommonResult selectRolerank(PageRequest pageRequest){
        return CommonResult.ok(rolerankService.selectRolerank(pageRequest));
    }
    /*
    * @Author wuwan
    * @Description 角色添加
    * @Date 2023/9/13 20:07
    * @Return 
    * @param null
    */
    @PostMapping("/addRolerank")
    public CommonResult addRolerank(MultipartFile file,RoleRank roleRank){
        return CommonResult.ok(rolerankService.addRolerank(file,roleRank));
    }
    /*
    * @Author wuwan
    * @Description 角色修改
    * @Date 2023/9/14 9:03
    * @Return
    * @param null
    */
    @PostMapping("/updateRolerank")
    public CommonResult updateRolerank(MultipartFile file,RoleRank roleRank){
        return CommonResult.ok(rolerankService.updateRolerank(file,roleRank));
    }
    /*
    * @Author wuwan
    * @Description 查询当前用户角色信息
    * @Date 2023/10/8 11:06
    * @Return
    */
    @GetMapping("/getRoleData")
    public CommonResult getRoleData( String openid){
        return CommonResult.ok(rolerankService.getRoleData(openid));
    }
}
